package com.changgou.seckill.service.impl;

import com.changgou.seckill.pojo.SeckillGoods;
import com.changgou.seckill.service.SecKillGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: 大佬味的小男孩
 * @date: 2020-08-07 18:13
 **/
@Service
public class SecKillGoodsServiceImpl implements SecKillGoodsService {

    @Autowired
    private RedisTemplate redisTemplate;

    private static final String SECKILL_KEY = "seckill_goods_";

    /**
     * @param time
     * @return java.util.List<com.changgou.seckill.pojo.SeckillGoods>
     * @description: 根据时间段获取改时间段的商品详情
     * @author 大佬味的小男孩
     * @date 2020/08/07 18:14
     */
    @Override
    public List<SeckillGoods> list(String time) {
        List<SeckillGoods> list = redisTemplate.boundHashOps(SECKILL_KEY + time).values();
        return list;
    }
}
